package ProxyTest;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyFactory implements InvocationHandler  {
    private Object target;
    public void setTarget(Object target) {
        this.target = target;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Helder();
        Object result = method.invoke(target, args);
        Tailer();
        return "我是：" + result;
    }

    public void Helder() {
        System.out.println("我是头部测试");
    }

    public void Tailer() {
        System.out.println("我是尾部测试");
    }
}
